<?php

class Quad_Form_Element_CheckboxCollection extends Quad_Form_Element_RadioCollection {
	
	protected $_memberClass = "Quad_Form_Element_Checkbox";
	
	public function getValue() {
		$checked = array();
		foreach ($this as $cbox) {
			if ($cbox->checked) {
				$checked[] = $cbox->checked;
			}
		}
		return $checked;
	}
	
	public function setValue($v) {
		$checked = (is_array($v) ? $v : array($v));
		foreach ($this as $cbox) {
			$cbox->checked = (in_array($cbox->value, $checked));
		}
		return $this;
	}		
	
}

